#include "FastCgiHandler.h"
#include <fastcgi++/http.hpp>

FastCgiHandler::FastCgiHandler(const std::string& url){
	init(url);
}

FastCgiHandler::~FastCgiHandler(){

}

void FastCgiHandler::init(const std::string& url){
	httpHandlerManage = new HttpHandlerManage();
	if(httpHandlerManage != NULL){
		httpHandlerManage->addHandlerMapping(url,this);
	}
}

//void FastCgiHandler::handle(Fastcgipp::Request<char>& req){
//#if 0

//	switch(req.environment().requestMethod){
//		case Fastcgipp::Http::RequestMethod::GET:
//			doGet(req);
//			break;
//		case Fastcgipp::Http::RequestMethod::POST:
//			doPost(req);
//			break;
//	}
//#endif
//	Fastcgipp::Http::Environment<char> env = const_cast<Fastcgipp::Http::Environment<char>>(req.environment());
//	switch(env.requestMethod) {
		
//		case Fastcgipp::Http::RequestMethod::GET:
//			doGet(req);
//			break;
//		case Fastcgipp::Http::RequestMethod::POST:
//			doPost(req);
//			break;
//	}
//}
 
void FastCgiHandler::doGet(const Fastcgipp::Http::Environment<char>& env,std::basic_ostream<char>& resp){
	
}

void FastCgiHandler::doPost(const Fastcgipp::Http::Environment<char>& env,std::basic_ostream<char>& resp){
	
}
